<script setup lang='ts'>
// 自定义 规则

import { ref, defineEmits, defineProps } from 'vue';
import Bottom from '@/components/bottom/index.vue'
import { showToast } from '@/public/index'
import { https } from '@/api/api'
const { isShow } = defineProps({
    isShow: {
        type: Boolean,
        default: () => false
    }
});

/**
 * @property 变量
 */
// 团队名称
const teamName = ref('');
const emits = defineEmits(['close', 'addCon']);

/**
 * @property  所有请求以api开头 如:apiDataInfo
 * / 


/**
 * @property 自定义事件 以事件名开头 如: clickButton,inputDev
 */
const clickAddTeam = async () => {
    // 添加团队
    if (!teamName.value) return showToast('团队名称不可为空');
    // 添加
    const res = await https({
        mode: 'team',
        name: 'apiAddTeam',
        data: {
            name: teamName.value
        }
    })
    showToast(res.data.msg);
    if (res.code !== 0) return
    emits('close')
    emits('addCon')
}
// 
const clickClose = () => {
    emits('close')
}
/**
 * @property 内置方法
 */


</script>
<template>
    <up-popup :show="isShow" closeable round="16" @close="clickClose">
        <div class="w-[100%] pl-3 pr-3 pt-10">
            <up-input placeholder="请输入团队名称" :border="'none'" clearable v-model="teamName" :customStyle="{
                background: '#F4FAFFFF',
                height: '72rpx',
                paddingLeft: '20rpx',
                paddingRight: '20rpx',
            }">
            </up-input>
            <div class="h-120 pb-3 pt-3 mt-3">
                <Bottom @click="clickAddTeam" />
            </div>
        </div>
    </up-popup>
</template>
<style lang="scss" scoped></style>